package org.jeecg.modules.simulator.service;

import org.jeecg.modules.simulator.loader.BasicDataFactory;
import org.jeecg.modules.simulator.util.UnitCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @program: simulator-b20240918
 * @description:
 * @author: renzhg
 * @create: 2024-10-04 13:49
 **/
@Component
public class ContextRefreshedListener   implements ApplicationListener<ContextRefreshedEvent> {


    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("容器初始化完毕");
        System.out.println("数据开始初始化");
        BasicDataFactory basicDataFactory = event.getApplicationContext().getBean(BasicDataFactory.class);
        basicDataFactory.setIsDb(true);
        UnitCache.globalSceneBaseData=basicDataFactory.loadBasicData();



        System.out.println("数据初始化完毕");

    }
}
